<script src="${request.contextPath}/easyuistatic/js/jquery-easyui-1.3.2/jquery-1.8.0.min.js"></script>
<script src="${request.contextPath}/easyuistatic/js/jquery-easyui-1.3.2/jquery.easyui.min.js"></script>
<script src="${request.contextPath}/easyuistatic/js/jquery-easyui-1.3.2/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="${request.contextPath}/easyuistatic/js/jquery-easyui-1.3.2/themes/cupertino/easyui.css" id="swicth-style">
<link rel="stylesheet" href="${request.contextPath}/easyuistatic/js/jquery-easyui-1.3.2/themes/icon.css">
<script src="${request.contextPath}/easyuistatic/js/extEasyui.js"></script>
<script src="${request.contextPath}/easyuistatic/js/extJquery.js"></script>
<script src="${request.contextPath}/easyuistatic/js/jquery.cookie.js"></script>
<script src="${request.contextPath}/easyuistatic/js/json2.js"></script>
<script src="${request.contextPath}/easyuistatic/js/arithmetic.js"></script>
<script src="${request.contextPath}/easyuistatic/js/ajaxfileupload.js"></script>

<style>
/* iframe table 修正字体变大 */
table{
	font-size: 12px;
}
</style>
<script type="text/javascript">
var url='${request.contextPath}';
// 格式化金额
function formatPrice(val,row){
 
	if(!val || '' == val){
		return '';
	} else if(val != ''){
		return fmoney(val , 2);
	} else {
		return '';
	}
	
}

// 格式化金额
function fmoney(s, n)   
{   
   n = n > 0 && n <= 20 ? n : 2;   
   s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";   
   var l = s.split(".")[0].split("").reverse(),   
   r = s.split(".")[1];   
   t = "";   
   for(i = 0; i < l.length; i ++ )   
   {   
      t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");   
   }   
   return t.split("").reverse().join("") + "." + r;   
}

    //文件上传 支持ie6
    //fileId上传空间id,filePath上传路径
	function uploadFiles(fileId,filePath,type)
	{
	    var fileName = $("#"+fileId).val();
	    if(null == fileName && "" == fileName)
	    {
	    	$.messager.alert("提示", '请选择要上传的文件', "info");
			return;
	    }
	    if(type)
	    {
	       //图片以外的格式 先不做限制
	       
	    }else{
	       //默认type没有，默认就是图片格式，支持jpg,png,bmp
	       	var fileNameindex = fileName.lastIndexOf(".");
			if (fileNameindex < 0) {
				$.messager.alert("提示", '请上传jpg、png、bmp格式的文件', "info");
				return;
			} else {
				var ext = fileName.substring(fileNameindex + 1, fileName.length);
				ext = ext.toUpperCase();
				if (ext != "JPG" && ext != "PNG" && ext != "BMP") {
					$.messager.alert("提示", '请上传jpg、png、bmp格式的文件', "info");
					return;
				}
			}
	       
	    }
		
		$.ajaxFileUpload({
				url : url+'/ossUpload.tool?filePath='+filePath,
				secureuri : false,
				fileElementId : fileId,
				dataType : 'json', //返回值类型 一般设置为json
				success : function(result) {
				    result = eval('(' + result + ')');
					uploadCallBack(result);
				},
				error : function(result, status, e) {
					$.messager.alert("提示", '系统异常', "error");	
				}
		});
	
		
	 }

//文件上传
function uploadFile(width, height, filePath, flag){
	var dialog =  ns.modalDialog({
	    title : '上传文件',
	    width : width == undefined ? 900 : width,
	    height : height == undefined ? 400 : height,
	    url : url + '/businessConsole/pages/tool/upload.jsp?filePath=' + filePath + '&flag=' + flag
	});

	return dialog;
}


// 设置datebox默认时间为当前时间
formatterDateEnd = function(date) {
	var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
	var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0"
			+ (date.getMonth() + 1);
	return date.getFullYear() + '-' + month + '-' + day;
};

// 设置datebox默认时间为每年每月一号
formatterDateStart = function(date) {
	var day = '01';
	var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0"
			+ (date.getMonth() + 1);
	return date.getFullYear() + '-' + month + '-' + day;
}; 

//格式化金额  保留六位
function formatPriceSix(val,row){

	if(!val || '' == val){
	
		return '0.000000';
	} else if(val != ''){
	
		return fmoney(val , 6);
	} else {
	
		return '';
	}
	
}
//1.第一步 写以下方法来格式化日期
Date.prototype.format = function (format) {
    var o = {
        "M+": this.getMonth() + 1, // month
        "d+": this.getDate(), // day
        "h+": this.getHours(), // hour
        "m+": this.getMinutes(), // minute
        "s+": this.getSeconds(), // second
        "q+": Math.floor((this.getMonth() + 3) / 3), // quarter
        "S": this.getMilliseconds()
        // millisecond
    }
    if (/(y+)/.test(format))
        format = format.replace(RegExp.$1, (this.getFullYear() + "")
            .substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(format))
            format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
    return format;
}
//2.第二步 扩展的Date的format方法(上述插件实现)
function formatDatebox(value) {

    if (value == null || value == '') {
        return '';
    }
    var dt;
    if (value instanceof Date) {
        dt = value;
    } else {
        dt = new Date(value);
    }

    return dt.format("yyyy-MM-dd hh:mm:ss");
}
</script>



